//
//  MyView.swift
//  swift3.0Exercise
//
//  Created by 刘培壮 on 2016/12/11.
//  Copyright © 2016年 com.solidInfo. All rights reserved.
//

import UIKit

class MyView: UIView {


    override func draw(_ rect: CGRect) {
        
    }
    
    func draw1() {
        let context = UIGraphicsGetCurrentContext()
        let path = UIBezierPath()
        path.move(to: CGPoint(x: 100, y: 100))
        path.addLine(to: CGPoint(x: 150, y: 250))
        path.addLine(to: CGPoint(x: 50, y: 200))
        context!.setLineWidth(10)
        context?.setLineJoin(.bevel)
        context?.setLineCap(.round)
        UIColor.red.set()
        context?.addPath(path.cgPath)
        context?.strokePath()

    }
    
    func draw2() {
        let context = UIGraphicsGetCurrentContext()
        let path = UIBezierPath(arcCenter: CGPoint(x: 100, y: 100), radius: 20, startAngle: -(CGFloat)(M_PI_2), endAngle: CGFloat(M_PI_2), clockwise: true)
        
        UIColor.red.set()
        context?.setLineWidth(5)
        context?.addPath(path.cgPath)
        context?.strokePath()
        
    }
}
